package 列表迭代器;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;

public class ListIteratorDemo {
    public static void main(String[] args) {
        List<String>list=new ArrayList<String>();
        list.add("shihaoqing");
        list.add("zhangpeng");
        list.add("zzk");
        ListIterator<String> s = list.listIterator();
        while (s.hasNext()){
            String next = s.next();
            System.out.println(next);
        }
        while (s.hasPrevious()){
            String previous = s.previous();
            System.out.println(previous);
        }


}}
